test=$(find tests/* -type d -print)
for path in $test
do
    folder=$(echo $path | cut -c 7-)
    if [ ! -d "out/${folder}" ]; then
        mkdir -p "out/${folder}"
    fi
    pas_file=$(find ${path}/* -type f -print)
    for fp in $pas_file
    do
        name=$(echo $fp | cut -d '/' -f 3 | cut -d '.' -f 1)
        ./app $fp > "out/${folder}/${name}.txt" 2>&1
        if [ $? -eq 139 ]; then
            echo "${fp} crashed!"
        fi
    done
done